package com.chenyuxin.ilp.controller.user;

import com.chenyuxin.ilp.model.pojo.Result;
import com.chenyuxin.ilp.service.user.VerificationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

// 短信验证码模块
@RestController
@RequestMapping("/user/verificationcode")
public class VerificationCodeController {
    @Autowired
    private VerificationCodeService verificationCodeService;
    @PostMapping("/send/login")
    public Result sendLoginVerificationCode(@RequestParam String phone,
                                            @RequestParam String captchaKey,
                                            @RequestParam String captcha){
        return verificationCodeService.sendLoginVerificationCode(phone,captchaKey,captcha);
    }
    @PostMapping("/send/register")
    public Result sendRegisterVerificationCode(@RequestParam String phone,
                                               @RequestParam String captchaKey,
                                               @RequestParam String captcha){
        return verificationCodeService.sendRegisterVerificationCode(phone,captchaKey,captcha);
    }
    @PostMapping("/verify")
    public Result verifyRegisterPhoneCode(@RequestParam String phone, @RequestParam String code){
        return verificationCodeService.verifyRegisterPhoneCode(phone,code);
    }
}
